{% extends 'main.html' %}
{% load i18n %}
{% block content %}
<div class="detail">
  <div class="post">
    <h1>{{note.title}}</h1>
    <h5>
        {{note.createTime|date:"Y-m-d H:i:s"}}&nbsp;&nbsp;
        {% trans "Category" %}:<a href="/?category={{note.jumCategory.key.id}}">{{note.jumCategory.name}}</a>
        &nbsp;&nbsp;
        {% trans "Tags" %}:
        {% for notetag in note.notetag_set %}
          {% if not forloop.first %}
          ,
          {% endif %}
            <a href="/main/notes/?tag={{notetag.tag.key.id}}">{{notetag.tag.name}}</a>
        {% endfor %}
    </h5>
    <p>{{note.content}}</p>
    </div>

    <div class="comments">
      <h3>{% trans "TrackBack" %}</h3>
      <h5>{% trans 'TrackBack URL' %}:&nbsp;{{config.siteHome}}feeds/trackBack/{{note.key.id}}/</h5>
      {% for trackBack in note.trackback_set %}
        <div class="comment">
          <h4>
                {{trackBack.blog_name}}-<a href="{{trackBack.url}}">{{trackBack.title|escape}}</a>({{trackBack.createTime|date:"Y-m-d H:i:s"}}):
          </h4>
          <p>{{trackBack.excerpt|escape|linebreaks}}</p>
          {% if admin %}
            <h4>
                  <a href="/admin/deleteTrackBack/?id={{trackBack.key.id}}&pid={{note.key.id}}" onClick="return confirm('{% trans "Are you sure?" %}')">
                  {% trans 'Delete' %}</a>
             </h4>
          {% endif %}
        </div>
      {% endfor %}
    </div>

    
    <div class="comments">
      <h3>{% trans "Comment" %}</h3>
      {% for comment in note.notecomment_set %}
        <div class="comment">
          <h4>
                {{comment.name|escape}}({{comment.createTime|date:"Y-m-d H:i:s"}}):
          </h4>
          <p>{{comment.content|escape|linebreaks}}</p>
          {% if admin %}
            <h4>
                  <a href="/admin/deleteNoteComment/?id={{comment.key.id}}&pid={{note.key.id}}" onClick="return confirm('{% trans "Are you sure?" %}')">
                  {% trans 'Delete' %}</a>
             </h4>
          {% endif %}
        </div>
      {% endfor %}
    </div>

    <div class="addcomment"
      <h4>{% trans "New Comment" %}</h4>
      <form name="comment" action="/client/addNoteComment/" method="post">
        <input type="hidden" name="id" value="{{note.key.id}}" />
        <p>{% trans "User Name" %}:
          <input name="name" type='text' size="40" />
        </p>
        <p>{% trans "Address" %}:
          <input name="address" type='text' size="40" />
        </p>
        <p>{% trans "Comment" %}:</p>
          <p><textarea name="content" rows="10" cols="52" ></textarea></p>
          <p class="subbutton">
            <input type='submit' value='{% trans "OK" %}' />
          </p>
      </form>
    </div>
</div>
{% endblock content %}